﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using HCMServices.DAO;
using HCMServices.DTO;
using System.Collections.Generic;

namespace HCMServices.Tests.TESTDAO
{
    /// <summary>
    /// Unit test for DataDAO class
    /// </summary>
    [TestClass]
    public class TestDataDAO
    {
        /// <summary>
        /// Unit test for SearchWithSoNha() method in DataDAO class
        /// </summary>
        [TestMethod]
        public void TestSearchWithSoNha()
        {
            string connectString = "Data Source = isostore:/Database.sdf";
            DataDAO dataDAO = new DataDAO(connectString);
            List<DataDTO> listDataDTO = null;
            listDataDTO = dataDAO.SearchWithSoNha("230");
            if (listDataDTO != null && listDataDTO.Count > 0 && listDataDTO[0].WardId == 170 && listDataDTO[0].StreetId == 882 && listDataDTO[0].ServiceId == 5 && listDataDTO[0].DistrictId == 26)
            {
                Assert.IsTrue(true);
                return;
            }

            Assert.IsFalse(true);
        }

        /// <summary>
        /// Unit test for Search() method in DataDAO class
        /// </summary>
        [TestMethod]
        public void TestSearch()
        {
             string connectString = "Data Source = isostore:/Database.sdf";
            DataDAO dataDAO = new DataDAO(connectString);
            List<DataDTO> listDataDTO = null;
            listDataDTO = dataDAO.Search("230", 5, 16, 26, 170, 882, 76865);
            if (listDataDTO != null && listDataDTO.Count > 0 && listDataDTO[0].WardId == 170 && listDataDTO[0].StreetId == 882 && listDataDTO[0].ServiceId == 5 && listDataDTO[0].DistrictId == 26)
            {
                Assert.IsTrue(true);
                return;
            }

            Assert.IsFalse(true);
        }
    }
}
